package service.impl;

import Dao.UserDao;
import Dao.impl.UserDaoimpl;
import pojo.User;
import service.UserServcive;

public class UserServiceImpl implements UserServcive {
    private UserDao User = new UserDaoimpl();
    @Override
    public void register(User user) {
        User.saveUser(user);
    }

    @Override
    public User login(User user) {
        return User.queryUsernameAndPsw(user.getUsername(), user.getPassword());
    }

    @Override
    public boolean existUsername(String username) {
        if(User.queryUsername(username)==null){
            return false;
        }else{
            return true;
        }
    }

}
